﻿
@using IOA.MES.DataAccess.VModel
@{
    ViewBag.Title = "选择站点";
    Layout = "~/Views/Shared/_LayoutPage.cshtml";
}
@model KeyValuePair<int,string>

@section Contents{
    <style>
        html {
            background-color: #FFF;
        }

        .layui-form-item .layui-input-inline {
/*            width: 300px;*/
        }
    </style>
}

<div id="page"></div>

<script type="text/ng-template" id="tplPage">
    <div class="layui-form" lay-filter="layuiadmin-app-form-list" style="padding: 20px 30px;">
        <div class="layui-form-item">
            <label class="layui-form-label" v-html="lang.Field.Site">站点：</label>
            <div class="layui-input-inline">
                <input type="text" value="@Model.Value" class="layui-input" disabled />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" v-html="lang.Field.UseMaterials">扣料：</label>
            <div class="layui-input-inline">
                <input type="checkbox" :title="lang.Field.UseMaterials" id="cbViaSite" />
            </div>
        </div>
        <div class="layui-form-item" style="text-align:center;padding-top: 20px;">
            <button class="layui-btn layui-btn-primary" onclick="parent.layer.close(parent.layer.getFrameIndex(window.name));"><i class="layui-icon">&#xe616;</i>{{lang.Field.Cancel}}</button>
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="submit"><i class="layui-icon">&#xe605;</i>{{lang.Field.Add}}</button>
        </div>
    </div>
</script>

@section Scripts{
    <script>
        var vm = new Vue({
            el: "#page",
            template: "#tplPage",
            data: {
                lang: JSON.parse(lang).package
            }
        });

        setTimeout(function () {
            initLayui();
        }, 50);

        function initLayui() {
            layui.use(['form', 'layer', 'index', 'laydate'], function () {
                var layer = layui.layer,
                    form = layui.form;

                form.on('submit(submit)', function (data) {
                    parent.addSite(@Model.Key, "@Model.Value", $("#cbViaSite")[0].checked);
                    parent.layer.close(parent.layer.getFrameIndex(window.name));
                    return false;
                });
            });
        }
    </script>
}
